package com.zjdiepu.www.commpent.mapper.dh;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.base.enums.type.RemindLoanType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.dh.dto.DhRemindLoanSub;
import com.zjdiepu.www.util.CachedEnums;
/**
 * 项目名称：diepu-parent-biz <br/> 
 * 类名称：DhRemindLoanSubVoMapper <br/>  
 * 类描述：银行放款还款提醒 <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月25日 下午5:51:41  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月25日 下午5:51:41   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class DhRemindLoanSubVoMapper extends BaseMapper<DhRemindLoanSub>{
	@Resource
	private RedisObjectClient redisObjectClient;
	@Override
	public void mapper(RedisConnection redisConnection,DhRemindLoanSub m) {
		if(null == m) {
			return;
		}
		
		Integer remindLoanType = m.getRemindLoanType();
		m.setRemindLoanTypeDisplay((String)CachedEnums.getValue(remindLoanType, RemindLoanType.class));
		
		String resultRemindLoan = m.getResultRemindLoan();
		SimpleDataDictionary resultRemindLoanDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),resultRemindLoan, DataDicType.LOAN_REMIND_RESULT_TYPE.getCode());
		m.setResultRemindLoanDisplay(resultRemindLoanDic == null ? "" : resultRemindLoanDic.getName());
		
		String resultRemindRepayment = m.getResultRemindRepayment();
		SimpleDataDictionary resultRemindRepaymentDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(),resultRemindRepayment, DataDicType.REPAYMENT_REMIND_RESULT_TYPE.getCode());
		m.setResultRemindRepaymentDisplay(resultRemindRepaymentDic == null ? "" : resultRemindRepaymentDic.getName());
	}
}
